@extends("/paging_template")
@import com.mgfireworks.mgplatform.mgadmin.sys.model.Organization
@import com.mgfireworks.mgplatform.mgadmin.constants.*
@args List<Organization> organizationList
	<s_panel>
		<s_title slot="title">请选择机构</s_title>
		<s_input name="orgName" value="@val("orgName")" text="机构名称"></s_input>
		<s_select name="orgType" value="@val("orgType")" text="机构类型">
			<option value="">所有类型</option>
			@for(OrgType o : OrgType.values()){
			<option value="@o.value()">@o.getPhrase()</option>
			}
		</s_select>
		<s_buttons slot="button" cols="3">
			<s_button type="query"></s_button>
			<s_button id="jsBtnSelect" type="select">选择</s_button>
			<s_button id="jsBtnCancelAndBack" type="del">取消</s_button>
		</s_buttons>
	</s_panel>

	<d_table min-width="800px">
		<d_tr slot="head">
            <d_th class="td_row_id"></d_th>
            <d_th>机构编号</d_th>
            <d_th>机构名称</d_th>
            <d_th>机构类型</d_th>
            <d_th>状态</d_th>
            <d_th>负责人</d_th>
            <d_th>联系方式</d_th>
            <d_th>区域编号</d_th>
		</d_tr>
        @if(organizationList){
        @{int i=0;}
        @for(Organization p : organizationList){
        <d_tr slot="body" class="table_row @(i%2==0?"odd":"event")">
        @{i++;}
        <d_td class="d_td_row_id">
            <input type="checkbox" class="flat" name="__recordId" value="@p.getOrgId()"/>
        </d_td>
        <d_td>@p.getOrgId()</d_td>
        <d_td>@p.getOrgName()</d_td>
        <d_td>@OrgType.valueOf(p.getOrgType()).getPhrase()</d_td>
        <d_td>@p.getOrgStatus()</d_td>
        <d_td>@p.getOrgOfficial()</d_td>
        <d_td>@p.getOrgContact()</d_td>
        <d_td>@p.getAreaId()</d_td>
        </d_tr>
        }}
	</d_table>

@section(script1){
	<script type="text/javascript">
		$(function(){
			$("#jsBtnSelect").unbind("click").click(function() {
			    var tds=$(".table_row.selected td");
			    if(tds.length>0){
                    util.el.postBack({orgId:$(tds[1]).text(),orgName:$(tds[2]).text()});
				}
                return false;
			});
		});
	</script>
}